package com.example.springboot.service.impl;

import com.example.springboot.entity.CityEntity;
import com.example.springboot.entity.DeptEntity;
import com.example.springboot.mapper.CityEntityMapper;
import com.example.springboot.mapper.DeptEntityMapper;
import com.example.springboot.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName UserServiceImp
 * @Author fuzhixuan
 * @Date 2021/12/28 10:58
 */
@Service
public class UserServiceImp implements UserService {
    @Autowired
    private CityEntityMapper cityEntityMapper;
    @Autowired
    private DeptEntityMapper deptEntityMapper;

    @Override
    public PageInfo<CityEntity> getAll() {
        PageHelper.startPage(2, 10);
        List<CityEntity> list = cityEntityMapper.getAll();
        return new PageInfo(list);
    }

    @Override
    public List<DeptEntity> getDeptList() {
        return deptEntityMapper.getDeptUsers();
    }

    @Override
    public int del(Integer id) {
        return cityEntityMapper.del(id);
    }

    @Override
    public int update(CityEntity cityEntity) {
        return cityEntityMapper.update(cityEntity);
    }
}
